Skip to content

bpo-34969: Add --fast, --best on the gzip CLI#9833

Merged
JulienPalard merged 14 commits into
python:masterfrom
matrixise:bpo-34969
Nov 3, 2018
Merged

bpo-34969: Add --fast, --best on the gzip CLI#9833
JulienPalard merged 14 commits into
python:masterfrom
matrixise:bpo-34969

Conversation

@matrixise

@matrixise matrixise commented Oct 13, 2018

Copy link
Copy Markdown
Member

@JulienPalard

Copy link
Copy Markdown
Member

I'm not for implementing -1 and -9 without implementing the whole range. Why not removing them, keeping only --best and --fast?

@matrixise

Copy link
Copy Markdown
Member Author

good catch, I have removed -1, -9 and -d can't accept --fast and --best.

Comment thread Lib/gzip.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit, I am not sure bester is a valid word. "Best compression" maybe?

@JulienPalard JulienPalard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you change the default compression from the CLI you may want to tell it in the NEWS file.

Comment thread Doc/library/gzip.rst Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing dot at end of sentence.

Comment thread Doc/library/gzip.rst Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same missing dot.

@bedevere-bot

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Comment thread Doc/library/gzip.rst Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of date?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vadmium sure, if we use the level 6, it's not the --best flag.

thanks

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, thanks

Comment thread Doc/library/gzip.rst Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"unversionned" python must not be used: please write python3 (and change the existing documentation for "file").

I'm not sure that it's useful to add an example of a command for each command line option.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, most examples in the current Doc do use an unversioned python for -m examples. Only a few currently use python3 -m. We should probably decide on which is better and fix them all. But that should be a separate issue and PR.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to use pythoninstead of python3 since that will add the extra work of replacing all python3 with python4 when we have a release in future :) Many examples will be compatible with both versions and also might cause issues in backporting doc fixes between two major versions . The URL and drop-down at the top already indicates python3.X version. I might be missing a use case here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remove the example with the command line and in this way, just avoid the "un.versioned" python.

Comment thread Lib/gzip.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make these constants private. If you really want to make them public, you should document them.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe with a new PR/bpo

Comment thread Doc/library/gzip.rst Outdated
@bedevere-bot

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Comment thread Lib/test/test_gzip.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test is redundant, assert_python_ok() ensures thta it's 0.

Comment thread Lib/test/test_gzip.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

11 lines just to pass a flag? IMHO it's too much, it can be done with less code: see below.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"gzip: Add --fast and --best options on the gzip CLI ..."

Comment thread Doc/library/gzip.rst Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to remove "it's a good tradeoff between the best and fast compression methods". I wouldn't promise that it's a good tradeoff. Compression is full of bad surprises.

Just one example from gzip manual page:
"In some rare cases, the --best option gives worse compression than the default compression level (-6). On some highly redundant files, compress compresses better than gzip."

Comment thread Lib/test/test_gzip.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we expect a specific exit code? Same question for following test.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@JulienPalard: Can you please double please? You can merge it if it looks good to you.

@matrixise

Copy link
Copy Markdown
Member Author

@JulienPalard are you interested by a merge of this PR?

@JulienPalard

Copy link
Copy Markdown
Member

LGTM too :) thanks @matrixise for this PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants